Fix #157787, reported by Jonathan Blandford:
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 Jul 2005 12:40:50 +0000 (12:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 7 Jul 2005 12:40:50 +0000 (12:40 +0000)
2005-07-07  Matthias Clasen  <mclasen@redhat.com>

Fix #157787, reported by Jonathan Blandford:

* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_set_current_folder): Don't leave a
"trail" behind when set_current_folder is called explicitly.
(gtk_file_chooser_default_update_current_folder): New function
that is called to update the current folder in response to
user actions.

* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Add a boolean
keep_trail argument, and don't leave a "trail" behind unless
it is set.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkpathbar.c
gtk/gtkpathbar.h

index 86162591a5d796f56fdf3bcd1567b5452e64d532..42646f5c9d4e0c4e3cbaf764c32d6951b3d9cc5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-07-07  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix #157787, reported by Jonathan Blandford: 
+       
+       * gtk/gtkfilechooserdefault.c 
+       (gtk_file_chooser_default_set_current_folder): Don't leave a 
+       "trail" behind when set_current_folder is called explicitly.
+       (gtk_file_chooser_default_update_current_folder): New function
+       that is called to update the current folder in response to
+       user actions.
+
+       * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Add a boolean
+       keep_trail argument, and don't leave a "trail" behind unless
+       it is set.
+
 2005-07-06  Manish Singh  <yosh@gimp.org>
 
        * demos/gtk-demo/menus.c: change_orientation() should return void,
index 86162591a5d796f56fdf3bcd1567b5452e64d532..42646f5c9d4e0c4e3cbaf764c32d6951b3d9cc5b 100644 (file)
@@ -1,3 +1,18 @@
+2005-07-07  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix #157787, reported by Jonathan Blandford: 
+       
+       * gtk/gtkfilechooserdefault.c 
+       (gtk_file_chooser_default_set_current_folder): Don't leave a 
+       "trail" behind when set_current_folder is called explicitly.
+       (gtk_file_chooser_default_update_current_folder): New function
+       that is called to update the current folder in response to
+       user actions.
+
+       * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Add a boolean
+       keep_trail argument, and don't leave a "trail" behind unless
+       it is set.
+
 2005-07-06  Manish Singh  <yosh@gimp.org>
 
        * demos/gtk-demo/menus.c: change_orientation() should return void,
index 86162591a5d796f56fdf3bcd1567b5452e64d532..42646f5c9d4e0c4e3cbaf764c32d6951b3d9cc5b 100644 (file)
@@ -1,3 +1,18 @@
+2005-07-07  Matthias Clasen  <mclasen@redhat.com>
+
+       Fix #157787, reported by Jonathan Blandford: 
+       
+       * gtk/gtkfilechooserdefault.c 
+       (gtk_file_chooser_default_set_current_folder): Don't leave a 
+       "trail" behind when set_current_folder is called explicitly.
+       (gtk_file_chooser_default_update_current_folder): New function
+       that is called to update the current folder in response to
+       user actions.
+
+       * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Add a boolean
+       keep_trail argument, and don't leave a "trail" behind unless
+       it is set.
+
 2005-07-06  Manish Singh  <yosh@gimp.org>
 
        * demos/gtk-demo/menus.c: change_orientation() should return void,
index 202e98414719a50fed4aea6822004b464ddab209..ae0c458356e3625d82f790d888b549d144894597 100644 (file)
@@ -313,6 +313,10 @@ static void     gtk_file_chooser_default_screen_changed (GtkWidget             *
 static gboolean       gtk_file_chooser_default_set_current_folder         (GtkFileChooser    *chooser,
                                                                            const GtkFilePath *path,
                                                                            GError           **error);
+static gboolean       gtk_file_chooser_default_update_current_folder      (GtkFileChooser    *chooser,
+                                                                           const GtkFilePath *path,
+                                                                           gboolean           keep_trail,
+                                                                           GError           **error);
 static GtkFilePath *  gtk_file_chooser_default_get_current_folder         (GtkFileChooser    *chooser);
 static void           gtk_file_chooser_default_set_current_name           (GtkFileChooser    *chooser,
                                                                            const gchar       *name);
@@ -1008,7 +1012,7 @@ change_folder_and_display_error (GtkFileChooserDefault *impl,
   path_copy = gtk_file_path_copy (path);
 
   error = NULL;
-  result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error);
+  result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, &error);
 
   if (!result)
     error_changing_folder_dialog (impl, path_copy, error);
@@ -4944,6 +4948,15 @@ static gboolean
 gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
                                             const GtkFilePath *path,
                                             GError           **error)
+{
+  return gtk_file_chooser_default_update_current_folder (chooser, path, FALSE, error);
+}
+
+static gboolean
+gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
+                                               const GtkFilePath *path,
+                                               gboolean           keep_trail,
+                                               GError           **error)
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
   gboolean result;
@@ -4965,7 +4978,7 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
   if (!check_is_folder (impl->file_system, path, error))
     return FALSE;
 
-  if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, error))
+  if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, keep_trail, error))
     return FALSE;
 
   if (impl->current_folder != path)
index 644aa1a1f92d6dc31cddf5afbab7427ec78c858a..ed80304fe161679d9fd64f1410d75d1101140e22 100644 (file)
@@ -1278,6 +1278,7 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
 gboolean
 _gtk_path_bar_set_path (GtkPathBar         *path_bar,
                        const GtkFilePath  *file_path,
+                       const gboolean      keep_trail,     
                        GError            **error)
 {
   GtkFilePath *path;
@@ -1294,7 +1295,8 @@ _gtk_path_bar_set_path (GtkPathBar         *path_bar,
   /* Check whether the new path is already present in the pathbar as buttons.
    * This could be a parent directory or a previous selected subdirectory.
    */
-  if (gtk_path_bar_check_parent_path (path_bar, file_path, path_bar->file_system))
+  if (keep_trail &&
+      gtk_path_bar_check_parent_path (path_bar, file_path, path_bar->file_system))
     return TRUE;
 
   path = gtk_file_path_copy (file_path);
@@ -1395,7 +1397,6 @@ _gtk_path_bar_set_path (GtkPathBar         *path_bar,
   return result;
 }
 
-
 /* FIXME: This should be a construct-only property */
 void
 _gtk_path_bar_set_file_system (GtkPathBar    *path_bar,
index 3ef4ba5bbd61f790d1cfdf03a52fdc33ce43cf25..f04146d5197919f05f2228b6734419f39f0ea408 100644 (file)
@@ -79,6 +79,7 @@ void     _gtk_path_bar_set_file_system (GtkPathBar         *path_bar,
                                        GtkFileSystem      *file_system);
 gboolean _gtk_path_bar_set_path        (GtkPathBar         *path_bar,
                                        const GtkFilePath  *file_path,
+                                       gboolean            keep_trail,
                                        GError            **error);
 void     _gtk_path_bar_up              (GtkPathBar *path_bar);
 void     _gtk_path_bar_down            (GtkPathBar *path_bar);